package com.qingcheng.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.seckill.SeckillGoods;
import com.qingcheng.service.seckill.SeckillService;
import com.qingcheng.util.DateUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * Welcome to the most Amazing IntelliJ IIIDEA.
 * Creat0r: ^_^ fffantianxing ^_^
 * Date: 2019-07-23
 * Time: 21:08
 */
@RestController
@RequestMapping("seckill")
public class SeckillGoodsController {
    @Reference
    private SeckillService seckillService;

    @GetMapping("menu")
    public List<Date> getDateMenus(){
        return DateUtil.getDateMenus();
    }

    @GetMapping("goodsList")
    public List<SeckillGoods> goodsList(String time){
        System.out.println(time);
        return seckillService.list(time);
    }

    @GetMapping("one")
    public SeckillGoods one(String time, String id){
        System.out.println(seckillService.one(time,id));
        return seckillService.one(time,id);
    }
}
